< previous page page_223 next page >

Page 223
Using a default value is ideal when you have some data in another location that you want to allow the user to override. This gives the user a starting point from which to change the data.
Positioning the Input Box
Unlike the MsgBox() dialog box, you can position an input box by specifying the Top and Left coordinates as the fourth and fifth parameters. Heres an example:
9f31265bb40b592b1929e18a47ab28e5.gif
Private Sub cmdPositioned_Click()
   Dim strName As String

   strName = InputBox("Enter an Employee Name", _
                      "Employee Name", _
                      "Bill Gates", _
                      Me.Left + lneSep.X1 + _
                      (Me.Width - Me.ScaleWidth), _
                      Me.Top + lneSep.Y1 + _
                      (Me.Height - Me.ScaleHeight))

   MsgBox "You input " & strName
End Sub
In the above example you use the ScaleWidth and ScaleHeight to get just the inside dimensions of the form you are on. These dimensions do not include the title bar, or the borders of the form.
This example lines up the InputBox() function with a form and a line control thats located on that form.
Common Dialog Control
One of the benefits of using the Windows operating system is the consistency you see between the different applications you use within Windows. This is due to a common set of dialog boxes included in the Windows dynamic link libraries (DLLs). Because its a little difficult to call the functions in the DLLs to display these dialog boxes, Visual Basic provides a custom control called the common dialog control that acts as a simple interface to these functions, thus making it much easier to use the common dialog boxes within your Visual Basic application. The following dialog boxes can be called from this control:

 
< previous page page_223 next page >

If you like this book, buy it!